<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // const arr1 = [11, 22, 33]
        // // 复制数组
        // const arr2 = arr1 // 引用赋值, 浅拷贝
        // arr2.push(44)
        // console.log(arr1)// 受影响了
        // // 深拷贝
        // const arr3 = [...arr1] // 展开运算符, 深拷贝
        // // 复制对象
        // const obj1 = {name: '张三', age: 18}
        // const obj2 = obj1 // 引用赋值, 浅拷贝
        // obj2.name = '李四'
        // console.log(obj1) // 受影响了
        // // 深拷贝
        // const obj3 = {...obj1} // 展开运算符, 深拷贝
        // console.log(obj3);
        
        // 合并数组
        const arr1 = [1, 2, 3]
        const arr2 = [4, 5, 6]
        const arr3 = [...arr1, ...arr2]
        console.log(arr3)
        // 合并对象
        const obj1 = {name: '张三'}
        const obj2 = {age: 18}
        const obj3 = {...obj1, ...obj2}
        console.log(obj3)
        

    </script>
</body>

</html>